import 'package:flutter/material.dart';

class WaimaiTitleComp extends StatefulWidget {
  const WaimaiTitleComp(
      {super.key,
      required this.title,
      required this.subTitle,
      this.showLine = true});

  final String title;
  final String? subTitle;
  final bool showLine;

  @override
  _WaimaiTitleCompState createState() => _WaimaiTitleCompState();
}

class _WaimaiTitleCompState extends State<WaimaiTitleComp> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          Row(
            children: [
              Text(
                widget.title,
                style: const TextStyle(color: Colors.black, fontSize: 14),
              ),
              Text(
                widget.subTitle ?? '',
                style: const TextStyle(
                  color: Colors.black38,
                  fontSize: 10,
                ),
              ),
            ],
          ),
          const SizedBox(height: 6),
          // 如果为true显示下划线
          if (widget.showLine)
            Container(
              width: 23,
              height: 2,
              color: Colors.yellow,
              child: const Text(''),
            ),
        ],
      ),
    );
  }
}
